package unimelb.discussiontracker.twitter.data.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import unimelb.discussiontracker.twitter.data.dao.ITopicDao;
import unimelb.discussiontracker.twitter.data.entity.TopicEntity;

@Repository
public class TopicDao extends GenericDataAccessObject<TopicEntity> implements ITopicDao {

    @Override
    public TopicEntity findByName(String name) {
        final Map<String, Object> queryParams = new HashMap<String, Object>();
        queryParams.put("topicText", name);
        return this.runSingleResultNamedQuery("Topic.FindByName", queryParams, null);
    }

    @Override
    public List<TopicEntity> findAll() {
        return this.runNamedQuery("Topic.FindAll", null, null);
    }

}
